<h:panelGrid xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" xmlns:t="http://myfaces.apache.org/tomahawk" width="100%"
	id="pnlContactPerson">
	<p:panel>
		<p:panelGrid style="width:100%" id="contactPersonInfo">
			<h:inputHidden value="#{evokPatientProfileBean.contactPerson.id}" />
			<p:row>
				<p:column>
					<h:outputLabel value="#{msgs.evok_contact_person_relationship} *" />
				</p:column>
				<p:column colspan="3">
					<p:selectOneMenu value="#{evokPatientProfileBean.contactPerson.relationship}" style="width:60%">
						<f:selectItem itemLabel="" itemValue="" />
						<f:selectItems value="#{sessionEnum['PatientRelationship']}" var="en" itemLabel="#{en.name}"
							itemValue="#{en.value}" />
					</p:selectOneMenu>
				</p:column>
			</p:row>
			<p:row>
				<p:column>
					<h:outputLabel value="#{msgs.empl_surname} *" />
				</p:column>
				<p:column>
					<p:inputText value="#{evokPatientProfileBean.contactPerson.surname}"
						style="width:95%;validator:checkNotNull(#{msgs.empl_surname})" maxlength="40" />
				</p:column>
				<p:column>
					<h:outputLabel value="#{msgs.empl_name} *" />
				</p:column>
				<p:column>
					<p:inputText value="#{evokPatientProfileBean.contactPerson.name}"
						style="width:95%;validator:checkNotNull(#{msgs.empl_name})" maxlength="40" />
				</p:column>
			</p:row>

			<p:row>
				<p:column>
					<h:outputLabel value="#{msgs.empl_street} *" />
				</p:column>
				<p:column colspan="3">
					<p:inputText value="#{evokPatientProfileBean.contactPerson.street}"
						style="width:95%;validator:checkNotNull(#{msgs.empl_street})" maxlength="80" />
				</p:column>
			</p:row>

			<p:row>
				<p:column>
					<h:outputLabel value="#{msgs.empl_liveplace} *" />
				</p:column>
				<p:column colspan="3">
					<h:panelGrid columns="3" styleClass="tableNoBorder" style="width:95%">
						<p:selectOneMenu id="region3" value="#{evokPatientProfileBean.contactRegionId}"
							converter="longConverter" style="width:220px;">
							<f:selectItem itemLabel="" itemValue="" />
							<f:selectItems value="#{cityBean.regionList}" var="re" itemLabel="#{re.name}"
								itemValue="#{re.id}" />
							<p:ajax update="city3,postcode3" listener="#{evokPatientProfileBean.contactRegionChange}" />
						</p:selectOneMenu>

						<p:selectOneMenu id="city3" value="#{evokPatientProfileBean.contactCityId}" converter="longConverter"
							style="validator:checkNotNull(#{msgs.default_city})">
							<f:selectItem itemLabel="" itemValue="" />
							<f:selectItems value="#{evokPatientProfileBean.contactCityList}" var="ct" itemLabel="#{ct.name}"
								itemValue="#{ct.id}" />
							<p:ajax update="postcode3" listener="#{evokPatientProfileBean.contactCityChange}" />
						</p:selectOneMenu>

						<h:outputText value="#{evokPatientProfileBean.contactPostcode}" id="postcode3" />
					</h:panelGrid>
				</p:column>
			</p:row>
			<p:row>
				<p:column>
					<h:outputLabel value="#{msgs.empl_tel_home}" />
				</p:column>
				<p:column>
					<p:inputText value="#{evokPatientProfileBean.contactPerson.tel1}" style="width:95%;" maxlength="40" />
				</p:column>
				<p:column>
					<h:outputLabel value="#{msgs.empl_tel_office}" />
				</p:column>
				<p:column>
					<p:inputText value="#{evokPatientProfileBean.contactPerson.tel1}" style="width:95%;" maxlength="40" />
				</p:column>
			</p:row>

			<p:row>
				<p:column>
					<h:outputLabel value="#{msgs.empl_mobile_home}" />
				</p:column>
				<p:column>
					<p:inputText value="#{evokPatientProfileBean.contactPerson.mobHome}" style="width:95%;" maxlength="40" />
				</p:column>
				<p:column>
					<h:outputLabel value="#{msgs.empl_mobile_office}" />
				</p:column>
				<p:column>
					<p:inputText value="#{evokPatientProfileBean.contactPerson.mobOffice}" style="width:95%;"
						maxlength="40" />
				</p:column>
			</p:row>

			<p:row>
				<p:column>
					<h:outputLabel value="#{msgs.empl_email1}" />
				</p:column>
				<p:column>
					<p:inputText value="#{evokPatientProfileBean.contactPerson.email1}" style="width:95%;" maxlength="40" />
				</p:column>
				<p:column>
					<h:outputLabel value="#{msgs.empl_email2}" />
				</p:column>
				<p:column>
					<p:inputText value="#{evokPatientProfileBean.contactPerson.email2}" style="width:95%;" maxlength="40" />
				</p:column>
			</p:row>
		</p:panelGrid>
		<f:facet name="footer">
			<h:panelGrid columns="2" width="100%" columnClasses="left,right">
				<p:commandButton value="#{msgs.button_reset}" icon="ui-icon-arrowrefresh-1-n"
					actionListener="#{evokPatientProfileBean.resetContactPerson}"
					update="contactPersonInfo,contactlist" />
						
				<p:commandButton value="#{msgs.button_submit}" icon="ui-icon-disk"
					onclick="return validator('paitentInfo:contactPersonInfo')"
					actionListener="#{evokPatientProfileBean.submitContactPerson}"
					update="contactlist,:messages,contactPersonInfo" />
			</h:panelGrid>
		</f:facet>
	</p:panel>

	<p:dataTable var="de" value="#{evokPatientProfileBean.contactPersonModel}" selectionMode="single" emptyMessage=""
		id="contactlist" widgetVar="wdgContactList">
		<p:ajax event="rowSelect" listener="#{evokPatientProfileBean.selectContactPerson}"
			update=":mainform:paitentInfo:contactPersonInfo" />

		<p:column headerText="#{msgs.empl_surname}">
			<h:outputText value="#{de.surname}" />
		</p:column>

		<p:column headerText="#{msgs.empl_name}">
			<h:outputText value="#{de.name}" />
		</p:column>

		<p:column headerText="#{msgs.evok_contact_person_relationship}">
			<h:outputText value="#{de.relationship}" converter="enumConverter" enumName="PatientRelationship" />
		</p:column>

		<p:column headerText="#{msgs.table_column_operation}">
			<p:commandLink oncomplete="confirmContactPerson.show()" style="float:right;"
				styleClass="ui-icon ui-icon-trash" title="#{msgs.button_delete}" type="image">
				<f:setPropertyActionListener value="#{de}" target="#{evokPatientProfileBean.contactPerson}" />
			</p:commandLink>
		</p:column>
	</p:dataTable>
</h:panelGrid>
